<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>拥有角色</title>
    <link rel="stylesheet" th:href="@{../css/bootstrap.min.css}">
</head>
<body>
<h3 class="pt-3 pb-3">拥有角色</h3>
<form th:action="@{../user/addRolesToUser}" method="post">
    <input type="hidden" name="uid" th:value="${uid}">
    <table class="table table-striped table-sm">
        <tr>
            <th>#</th>
            <th>角色编号</th>
            <th>角色名称</th>
            <th>角色描述</th>
        </tr>
        <tr th:each="sysRole : ${allRoles}">
            <td th:if="${#lists.contains(hasRoles, sysRole.id) == true}"><input type="checkbox" name="rids" th:value="${sysRole.id}" checked></td>
            <td th:if="${#lists.contains(hasRoles, sysRole.id) != true}"><input type="checkbox" name="rids" th:value="${sysRole.id}"></td>
            <td th:text="${sysRole.id}"></td>
            <td th:text="${sysRole.name}"></td>
            <td th:text="${sysRole.desc}"></td>
        </tr>
        <tr>
            <th><input class="btn btn-success btn-sm" type="submit" value="保存"></th>
        </tr>
    </table>
</form>
<script th:src="@{../js/jquery-3.5.1.min.js}"></script>
<script th:src="@{../js/bootstrap.bundle.min.js}"></script>
</body>
</html>